/*
 Navicat Premium Data Transfer

 Source Server         : localhost_root
 Source Server Type    : MySQL
 Source Server Version : 80026
 Source Host           : localhost:3306
 Source Schema         : ucode-cms2

 Target Server Type    : MySQL
 Target Server Version : 80026
 File Encoding         : 65001

 Date: 21/02/2022 15:08:52
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for tb_dept
-- ----------------------------
DROP TABLE IF EXISTS `tb_dept`;
CREATE TABLE `tb_dept` (
  `dept_id` bigint NOT NULL COMMENT '主键ID（全局唯一）',
  `dept_name` varchar(30) DEFAULT NULL COMMENT '部门名称',
  `staff` int DEFAULT NULL COMMENT '员工',
  `tel` varchar(50) DEFAULT NULL COMMENT '联系电话',
  `deleted` bit(1) DEFAULT b'0' COMMENT '逻辑删除（0:未删除；1:已删除）',
  `version` int DEFAULT '0' COMMENT '乐观锁',
  `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`dept_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='部门';

-- ----------------------------
-- Records of tb_dept
-- ----------------------------
BEGIN;
INSERT INTO `tb_dept` VALUES (10, 'Java', 20, '88886666', b'0', 4, '2020-10-30 11:48:19', '2021-05-24 15:11:17');
INSERT INTO `tb_dept` VALUES (11, 'Mysql', 12, '80802121', b'0', 0, '2020-10-30 11:48:44', '2021-05-24 15:11:20');
INSERT INTO `tb_dept` VALUES (12, 'Tomcat', 12, '23231212', b'0', 0, '2020-10-30 11:48:44', '2021-05-24 15:11:23');
INSERT INTO `tb_dept` VALUES (13, 'Nginx', 13, '7116201', b'0', 0, '2020-10-30 11:48:45', '2021-05-24 15:11:26');
COMMIT;

-- ----------------------------
-- Table structure for tb_passenger
-- ----------------------------
DROP TABLE IF EXISTS `tb_passenger`;
CREATE TABLE `tb_passenger` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `name` varchar(32) DEFAULT NULL COMMENT '姓名',
  `sex` bit(1) DEFAULT NULL COMMENT '性别',
  `birthday` varchar(32) DEFAULT NULL COMMENT '出生日期',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COMMENT='乘客表';

-- ----------------------------
-- Records of tb_passenger
-- ----------------------------
BEGIN;
INSERT INTO `tb_passenger` VALUES (1, '张三', b'1', '2010-10-01');
INSERT INTO `tb_passenger` VALUES (2, '王五', b'0', '2009-09-01');
COMMIT;

-- ----------------------------
-- Table structure for tb_passport
-- ----------------------------
DROP TABLE IF EXISTS `tb_passport`;
CREATE TABLE `tb_passport` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `nationality` varchar(32) DEFAULT NULL COMMENT '国籍',
  `expire` varchar(32) DEFAULT NULL COMMENT '过期时间',
  `owner` bigint DEFAULT NULL COMMENT '所有者',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3 COMMENT='护照表';

-- ----------------------------
-- Records of tb_passport
-- ----------------------------
BEGIN;
INSERT INTO `tb_passport` VALUES (1, '美国', '2022-10-01', 1);
INSERT INTO `tb_passport` VALUES (2, '英国', '2010-11-12', 2);
INSERT INTO `tb_passport` VALUES (3, '法国', '2021-01-02', NULL);
COMMIT;

-- ----------------------------
-- Table structure for tb_relation
-- ----------------------------
DROP TABLE IF EXISTS `tb_relation`;
CREATE TABLE `tb_relation` (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID（全局唯一）',
  `passenger_id` bigint unsigned DEFAULT NULL COMMENT '乘客ID',
  `passport_id` bigint unsigned DEFAULT NULL COMMENT '护照ID',
  `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `stu_id` (`passenger_id`,`passport_id`),
  KEY `fk_sub_id` (`passport_id`),
  CONSTRAINT `tb_relation_ibfk_1` FOREIGN KEY (`passenger_id`) REFERENCES `tb_passenger` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `tb_relation_ibfk_2` FOREIGN KEY (`passport_id`) REFERENCES `tb_passport` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb3 COMMENT='成绩表';

-- ----------------------------
-- Records of tb_relation
-- ----------------------------
BEGIN;
INSERT INTO `tb_relation` VALUES (1, 1, 1, '2020-11-01 10:31:27', NULL);
INSERT INTO `tb_relation` VALUES (2, 1, 2, '2020-11-01 10:31:36', NULL);
INSERT INTO `tb_relation` VALUES (3, 2, 1, '2020-11-01 10:31:45', NULL);
INSERT INTO `tb_relation` VALUES (4, 2, 2, '2020-11-01 10:31:52', NULL);
INSERT INTO `tb_relation` VALUES (5, 1, 3, '2020-11-01 10:32:02', NULL);
COMMIT;

-- ----------------------------
-- Table structure for tb_staff
-- ----------------------------
DROP TABLE IF EXISTS `tb_staff`;
CREATE TABLE `tb_staff` (
  `user_id` bigint NOT NULL COMMENT '主键ID（全局唯一）',
  `user_name` varchar(30) DEFAULT NULL COMMENT '姓名',
  `age` int DEFAULT NULL COMMENT '年龄',
  `email` varchar(50) DEFAULT NULL COMMENT '邮箱',
  `dept_id` bigint DEFAULT NULL COMMENT '部门ID',
  `deleted` bit(1) DEFAULT b'0' COMMENT '逻辑删除（0:未删除；1:已删除）',
  `version` int DEFAULT '0' COMMENT '乐观锁',
  `gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `gmt_modified` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  PRIMARY KEY (`user_id`),
  KEY `dept_id` (`dept_id`),
  CONSTRAINT `tb_staff_ibfk_1` FOREIGN KEY (`dept_id`) REFERENCES `tb_dept` (`dept_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='职员表';

-- ----------------------------
-- Records of tb_staff
-- ----------------------------
BEGIN;
INSERT INTO `tb_staff` VALUES (1, 'Jone', 1, 'ab@c.c', 10, b'0', 0, NULL, '2021-05-24 15:12:01');
INSERT INTO `tb_staff` VALUES (2, 'Jack', 3, 'test2@baomidou.com', 11, b'0', 0, NULL, '2021-05-24 15:12:04');
INSERT INTO `tb_staff` VALUES (3, 'Billie', 2, 'test5@baomidou.com', 12, b'0', 0, NULL, '2021-10-21 10:51:24');
INSERT INTO `tb_staff` VALUES (4, 'didi', 12, 'test@qq.com', 12, b'0', 0, '2021-06-05 19:22:46', '2021-10-21 14:38:26');
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
